package ltd.hxya.novel.admin.controller;

import io.swagger.annotations.Api;
import ltd.hxya.novel.admin.service.OssService;
import ltd.hxya.novel.common.bean.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;


@RequestMapping("/eduoss/fileoss")
@RestController
@CrossOrigin
@Api(description="阿里云文件管理")
public class OssController {
    @Autowired
    private OssService ossService;

    @PostMapping
    public Result<String> uploadOssFile(MultipartFile file){
        String url = ossService.uploadFileAvatar(file);
         // 获取上传文件
         // return R.ok().data("url",url);
        return Result.success(url);
    }

}
